{% extends "base_admin.html" %}

{% block title %}分类列表{% endblock %}

{% block admincontent %}
    <h2>分类列表</h2>
    <div>
        <ul>
            {% for category in categoryList %}
            <li>
            <form name="set_{{ forloop.counter }}" method="post" action="/admin?action=setCategory" >
                <input type="hidden" name="key" value="{{ category.key|escape }}" />
                <input type="text" name="name" value="{{ category.name|escape }}" />
                <button type="submit">修改名称</button>
            </form>
            | 
            <form name="del_{{ forloop.counter }}" method="post" action="/admin?action=deleteCategory" >
                <input type="hidden" name="key" value="{{ category.key|escape }}" />
                <button type="submit">删除</button>
            </form>

            </li>
            {% endfor %}
        </ul>
    </div>

    <br />
    <br />
    <hr />
    <br />
    <br />

    <h2>创建分类</h2>
    <div>
        <form name="create_category" method="post" action="/admin?action=addCategory">
            <input type="text" name="name" value="" />
            <button type="submit">新增</button>
        </form>
    </div>
{% endblock %}

